package com.example.tests;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.util.Set;

import org.testng.annotations.Test;

public class ContactModificationTests extends TestBase {

	@Test
	public void testFirstContactCanBeModified() throws Exception {
		ContactObject validContact2 = new ContactObject()
				.setFirstName("Enter_first_name_MODIFIED")
				.setLastName("Enter_last_name_MODIFIED")
				.setAddressFirst("MODIFIED_Enter_address")
				.setHomePhone("Home phone 1234567")
				.setMobilePhone("mobile 987654321")
				.setWorkPhone("work phone 35643189")
				.setEmailFirst("email1@fnwiogfiyMODIFIEDuefn.nvuw")
				.setEmailSecond("ojnvfwefMODIFIEDno32@fvnwerf.vnui")
				.setBirthYear("1900")
				.setAddressSecond("secondary MODIFIED adress here")
				.setPhoneSecond("home adressMODIFIEDssss")
				.setBirthDate("15")
				.setBirthMonth("July");
		Set<ContactObject> oldList = app.getContactHelper().getContacts();
		int numberOfContactForModification	= 2;
		app.getContactHelper().modifyContact(numberOfContactForModification, validContact2);
		// validate
		Set<ContactObject> newList = app.getContactHelper().getContacts();
		verifyContactModified(oldList, validContact2, newList);
	}

	private void verifyContactModified(Set<ContactObject> oldList,
			ContactObject validContact2, Set<ContactObject> newList) {
		assertThat(newList.size(), equalTo(oldList.size()));
	// 	assertThat(newList, NOTequalTo(oldList));
		
	}
}
